package base.assertTest;

/**
 * @Author: hmm
 * @Created: 2019/12/10
 * @Description:
 * @Modified by:
 */
public class AssertDemo {
    public static void main(String[] args) {
        test(-1);
    }

    private static void test(int i) {
        try {
            //断言抛出的异常 是继承自error
            assert (i > 0);
            System.out.println(i);
        } catch (Error e) {
            System.out.println("出错");
        }
    }
}
